//
//  BaseCollectionViewController+Refresh.m
//  HappyRent
//
//  Created by CoderYee on 2017/3/31.
//  Copyright © 2017年 内圈科技. All rights reserved.
//

#import "BaseCollectionViewController+Refresh.h"
#import "YeeRefreshHeader.h"

@implementation BaseCollectionViewController (Refresh)

//添加刷新事件
-(void)CollectionPullupHeaderRefresh:(void (^)(void))headerBlock{
   
    
    __weak typeof(self)weakself=self;
    YeeRefreshHeader  *headerView=[YeeRefreshHeader  headerWithRefreshingBlock:^{
        if (headerBlock)
        {
            headerBlock();
        }
    }];
    weakself.collectionView.mj_header=headerView;
    
}
-(void)CollectionPullDownFootRefresh:(void (^)(void))footerBlock{
  
    __weak typeof(self)weakself=self;
    MJRefreshBackNormalFooter  *footrefreshView=[MJRefreshBackNormalFooter  footerWithRefreshingBlock:^{
        if (footerBlock)
        {
            footerBlock();
        }
    }];
    weakself.collectionView.mj_footer=footrefreshView;
    
}
//停止刷新
-(void)CollectionViewEndRefresh{
    
    [self.collectionView.mj_footer endRefreshing];
    [self.collectionView.mj_header endRefreshing];
}
@end
